<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>新增页面</title>
        <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" />
        <link rel="stylesheet" href="/app/admin/admin/css/reset.css" />
    </head>
    <body>

        <form class="layui-form" action="">

            <div class="mainBox">
                <div class="main-container mr-5">
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">用户ID</label>
                        <div class="layui-input-block">
                            <input type="number" name="user_id" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">公司名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="company_name" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">联系人姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="contact_name" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">联系电话</label>
                        <div class="layui-input-block">
                            <input type="text" name="phone" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">电子邮箱</label>
                        <div class="layui-input-block">
                            <input type="text" name="email" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">联系地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="address" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">客户类型(印刷企业/光刻纸制造企业/设计公司/其他)</label>
                        <div class="layui-input-block">
                            <input type="text" name="customer_type" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">设计图ID/名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="design_id" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">设计来源(我公司官方设计库/自由设计师上传)</label>
                        <div class="layui-input-block">
                            <input type="text" name="design_source" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">设计师ID/姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="designer_name" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">是否已获得设计授权(1是/0否)</label>
                        <div class="layui-input-block">
                            <input type="number" name="has_authorization" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">产品用途</label>
                        <div class="layui-input-block">
                            <input type="text" name="product_usage" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">特殊要求说明</label>
                        <div class="layui-input-block">
                            <textarea name="special_requirements" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">光刻尺寸长度(毫米)</label>
                        <div class="layui-input-block">
                            <input type="text" name="size_length_mm" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">光刻尺寸宽度(毫米)</label>
                        <div class="layui-input-block">
                            <input type="text" name="size_width_mm" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">模压方式(热压/UV压/不懂不清楚)</label>
                        <div class="layui-input-block">
                            <input type="text" name="pressing_method" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">镀铝方式(镀铝/镀介质/不懂不清楚)</label>
                        <div class="layui-input-block">
                            <input type="text" name="aluminum_method" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">覆膜方式(复合纸/转移纸/不懂不清楚)</label>
                        <div class="layui-input-block">
                            <input type="text" name="film_method" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">样品纸张规格长度(毫米)</label>
                        <div class="layui-input-block">
                            <input type="text" name="paper_size_length" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">样品纸张规格宽度(毫米)</label>
                        <div class="layui-input-block">
                            <input type="text" name="paper_size_width" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">纸张克重(gsm)</label>
                        <div class="layui-input-block">
                            <input type="number" name="paper_weight" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">纸张类型</label>
                        <div class="layui-input-block">
                            <input type="text" name="paper_type" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">其他纸张类型说明</label>
                        <div class="layui-input-block">
                            <input type="text" name="other_paper_type" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否指定纸张(1是/0否)</label>
                        <div class="layui-input-block">
                            <input type="number" name="is_paper_specified" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">指定纸张说明</label>
                        <div class="layui-input-block">
                            <input type="text" name="specified_paper" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">样品纸张数量(份)</label>
                        <div class="layui-input-block">
                            <input type="number" name="quantity" value="1" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">其他特殊工艺需求</label>
                        <div class="layui-input-block">
                            <textarea name="other_requirements" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">交付地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="delivery_address" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">期望交付日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="expected_date" id="expected_date" required lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">物流方式(普通快递/加急快递/自提)</label>
                        <div class="layui-input-block">
                            <input type="text" name="logistics_method" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">设计源文件(JSON格式存储文件路径)</label>
                        <div class="layui-input-block">
                            <textarea name="design_files" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">修改意见文件(JSON格式存储文件路径)</label>
                        <div class="layui-input-block">
                            <textarea name="modification_files" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">光刻服务费(元)</label>
                        <div class="layui-input-block">
                            <input type="text" name="service_charge" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">纸张打样费(元)</label>
                        <div class="layui-input-block">
                            <input type="text" name="paper_charge" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">总打样费用(元)</label>
                        <div class="layui-input-block">
                            <input type="text" name="total_charge" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否需要开具发票(1是/0否)</label>
                        <div class="layui-input-block">
                            <input type="number" name="need_invoice" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">发票抬头</label>
                        <div class="layui-input-block">
                            <input type="text" name="invoice_title" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">申请状态(待审核/已确认/生产中/已完成/已取消)</label>
                        <div class="layui-input-block">
                            <input type="text" name="status" value="待审核" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">跟进状态(0未跟进/1已跟进)</label>
                        <div class="layui-input-block">
                            <input type="number" name="follow_up_status" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <textarea name="remark" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">创建时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="created_at" id="created_at" value="CURRENT_TIMESTAMP" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">更新时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="updated_at" id="updated_at" value="CURRENT_TIMESTAMP" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                </div>
            </div>

            <div class="bottom">
                <div class="button-container">
                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit=""
                        lay-filter="save">
                        提交
                    </button>
                    <button type="reset" class="pear-btn pear-btn-md">
                        重置
                    </button>
                </div>
            </div>
            
        </form>

        <script src="/app/admin/component/layui/layui.js"></script>
        <script src="/app/admin/component/pear/pear.js"></script>
        <script src="/app/admin/admin/js/permission.js"></script>
        
        <script>

            // 相关接口
            const INSERT_API = "/app/admin/application/insert";
            
            // 字段 期望交付日期 expected_date
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#expected_date",
                    type: "datetime",
                });
            })
            
            // 字段 创建时间 created_at
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#created_at",
                    type: "datetime",
                });
            })
            
            // 字段 更新时间 updated_at
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#updated_at",
                    type: "datetime",
                });
            })
            
            //提交事件
            layui.use(["form", "popup"], function () {
                // 字段验证允许为空
                layui.form.verify({
                    phone: [/(^$)|^1\d{10}$/, "请输入正确的手机号"],
                    email: [/(^$)|^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/, "邮箱格式不正确"],
                    url: [/(^$)|(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/, "链接格式不正确"],
                    number: [/(^$)|^\d+$/,'只能填写数字'],
                    date: [/(^$)|^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/, "日期格式不正确"],
                    identity: [/(^$)|(^\d{15}$)|(^\d{17}(x|X|\d)$)/, "请输入正确的身份证号"]
                });
                layui.form.on("submit(save)", function (data) {
                    layui.$.ajax({
                        url: INSERT_API,
                        type: "POST",
                        dateType: "json",
                        data: data.field,
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功", function () {
                                parent.refreshTable();
                                parent.layer.close(parent.layer.getFrameIndex(window.name));
                            });
                        }
                    });
                    return false;
                });
            });

        </script>

    </body>
</html>
